package org.zhxy.core.quality.controller;

import org.springframework.web.bind.annotation.*;
import org.zhxy.common.aop.AutomaticLog;
import org.zhxy.common.config.ServiceFactory;
import org.zhxy.common.response.PageResult;
import org.zhxy.common.response.Result;
import org.zhxy.entity.quality.Classes;

import java.util.Map;

@RestController
@RequestMapping("/classes")
public class ClassesController {


    @AutomaticLog("查询班级集合")
    @RequestMapping(value = "/getClassesList",method = RequestMethod.POST)
    public Result getClassesList(@RequestBody Map<String, Object> map){
        PageResult<Classes> result = ServiceFactory.classesService.getClassesList(map);
        return Result.SUCCESS_NO_MESSAGE(result);
    }

    @AutomaticLog("保存班级信息")
    @RequestMapping(value = "/saveClasses",method = RequestMethod.POST)
    public Result saveClasses(@RequestBody Classes classes){
        return ServiceFactory.classesService.saveClasses(classes);
    }

    @AutomaticLog("修改班级信息")
    @RequestMapping(value = "/updateClasses",method = RequestMethod.POST)
    public Result updateClasses(@RequestBody Classes classes){
        return ServiceFactory.classesService.updateClasses(classes);
    }

    @AutomaticLog("查询某个班级的所有带班老师")
    @RequestMapping(value = "/handleShowTeachers/{classesId}",method = RequestMethod.GET)
    public Result handleShowTeachers(@PathVariable("classesId")String classesId){
        return Result.SUCCESS_NO_MESSAGE(ServiceFactory.classesService.handleShowTeachers(classesId));
    }

    @AutomaticLog("某个班级替换班主任和教员")
    @RequestMapping(value = "/appointTeachers",method = RequestMethod.POST)
    public Result appointTeachers(@RequestBody Map<String, Object>map){
        return ServiceFactory.classesService.appointTeachers(map);
    }
}
